// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
let machineListUrl = '/customer/machine/list'; //机器列表
let machineGetUrl = '/customer/machine/get'; //获取单个机器信息

let machineCopyUrl = '/customer/machine/copy'; //一键拷贝其他机器信息
let customer_machineAddGoodsUrl = '/customer/machine/addGoods'; //新增机器正在出售的商品
let customer_machineEditGoodsUrl = '/customer/machine/editGoods'; //修改机器正在出售的商品
let customer_machineDeleteUrl = '/customer/machine/deleteOne'; //修改机器正在出售的商品
let customer_machineDeleteGoodsUrl = '/customer/machine/deleteGoods'; //删除机器正在出售的商品
let customer_machineEditOneGoodsWayUrl = '/customer/machine/editOneGoodsWay'; //修改货道
let customer_machineEditOneUrl = '/customer/machine/editOne'; //修改单个机器信息
let customer_machineChangeStatusUrl = '/customer/machine/changeStatus'; //修改机器状态
let customer_editSelfUrl = '/customer/editSelf'; //修改客户个人信息
let checkLoginUrl = '/login/customer';
let customer_getDataUrl = '/customer/getData';
let customer_modelListUrl='/customer/model/list';
let customer_machineAddUrl='/customer/machine/add';
let customer_machineFullUrl = '/customer/machine/full'; //一键补满所有货道
let customer_orderListUrl = '/customer/order/list'; //一键补满所有货道

let admin_checkLoginUrl = '/login/admin';
let admin_editSelfUrl = '/admin/editSelf';
let admin_modelListUrl="/admin/model/list";
let admin_modelEditUrl="/admin/model/edit";
let admin_modelAddUrl="/admin/model/add";
let admin_modelDeleteUrl="/admin/model/delete";
let admin_customerListUrl="/admin/customer/list";
let admin_customerAddUrl="/admin/customer/add";
let admin_customerEditUrl="/admin/customer/edit";
let admin_customerDeleteUrl="/admin/customer/delete";

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 此处没有使用传入的params参数
	let machineList = (params = {}) => vm.$u.get(machineListUrl, params);
	let machineGet = (params = {}) => vm.$u.get(machineGetUrl, params);
	
	let machineCopy = (params = {}) => vm.$u.get(machineCopyUrl, params);
	let customer_machineAddGoods = (params = {}) => vm.$u.post(customer_machineAddGoodsUrl, params);
	let customer_machineEditGoods = (params = {}) => vm.$u.post(customer_machineEditGoodsUrl, params);
	let customer_machineDelete = (params = {}) => vm.$u.get(customer_machineDeleteUrl, params);
	let customer_machineDeleteGoods = (params = {}) => vm.$u.post(customer_machineDeleteGoodsUrl, params);
	let customer_machineEditOneGoodsWay = (params = {}) => vm.$u.post(customer_machineEditOneGoodsWayUrl, params);
	let customer_machineEditOne = (params = {}) => vm.$u.post(customer_machineEditOneUrl, params);
	let customer_machineChangeStatus = (params = {}) => vm.$u.post(customer_machineChangeStatusUrl, params);
	let checkLogin = (params = {}) => vm.$u.post(checkLoginUrl, params);
	let customer_editSelf = (params = {}) => vm.$u.post(customer_editSelfUrl, params);
	let customer_getData = (params = {}) => vm.$u.get(customer_getDataUrl, params);
	let customer_modelList = (params = {}) => vm.$u.get(customer_modelListUrl, params);
	let customer_machineAdd = (params = {}) => vm.$u.post(customer_machineAddUrl, params);
	let customer_machineFull = (params = {}) => vm.$u.get(customer_machineFullUrl, params);
	let customer_orderList = (params = {}) => vm.$u.get(customer_orderListUrl, params);
	
	
	//管理相关
	let admin_checkLogin = (params = {}) => vm.$u.post(admin_checkLoginUrl, params);
	let admin_editSelf = (params = {}) => vm.$u.post(admin_editSelfUrl, params);
	let admin_modelList = (params = {}) => vm.$u.get(admin_modelListUrl, params);
	let admin_modelAdd = (params = {}) => vm.$u.post(admin_modelAddUrl, params);
	let admin_modelEdit = (params = {}) => vm.$u.post(admin_modelEditUrl, params);
	let admin_modelDelete = (params = {}) => vm.$u.get(admin_modelDeleteUrl, params);
	let admin_customerList = (params = {}) => vm.$u.get(admin_customerListUrl, params);
	let admin_customerAdd = (params = {}) => vm.$u.post(admin_customerAddUrl, params);
	let admin_customerEdit = (params = {}) => vm.$u.post(admin_customerEditUrl, params);
	let admin_customerDelete = (params = {}) => vm.$u.get(admin_customerDeleteUrl, params);
	
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		checkLogin,
		machineList,
		machineGet,
		machineCopy,
		customer_machineDelete,
		customer_machineEditOneGoodsWay,
		customer_machineEditOne,
		customer_machineChangeStatus,
		customer_editSelf,
		customer_getData,
		customer_modelList,
		customer_machineAdd,
		customer_machineFull,
		customer_machineAddGoods,
		customer_machineEditGoods,
		customer_machineDeleteGoods,
		customer_orderList,
		
		admin_checkLogin,
		admin_editSelf,
		admin_modelList,
		admin_modelAdd,
		admin_modelEdit,
		admin_modelDelete,
		admin_customerList,
		admin_customerAdd,
		admin_customerEdit,
		admin_customerDelete
	};
}

export default {
	install
}